<?php
require_once("../../../config.inc.php");
$isPopUp = true;
require_once("../../../app/_inc/include.php");
$objUser = $_SESSION[USEROBJ];
$sSQL = "SELECT DISTINCT d.* FROM domain d " .
		" LEFT JOIN attribute a ON a.domain = d.domain " .
		" WHERE (a.entity NOT LIKE '".$_REQUEST['da']."_%' OR ISNULL(a.entity)) AND d.frequent='N'" .
		" ORDER BY d.domain";
$objSDAO->query($sSQL, "dom");
//output HTML
$aOpz = array("tit2"=>_t("Selezione dominio"), "isReloadable"=>false);
echo(headerHTML($aOpz));
?>
<script language="JavaScript" type="text/javascript">
	function setDomOnParent(domSel) {
		var objDoc = window.opener.document;
		var objDom = objDoc.getElementById("domain");
		objDom.options[0].text=domSel;
		objDom.options[0].value=domSel;
		objDom.selectedIndex=0;
		window.close();
	}
</script>
<?
echo(bodyPopUpHTML($aOpz));
?>
<table class="tabl01" width="100%" cellpadding="3" cellspacing="2">
	<tr>
		<td class='titl01' colspan='5'>List of domains</td>
	</tr>
	<tr>
		<td class='tabh01'>Domain</td>
		<td class='tabh01'>Description</td>
		<td class='tabh01'>Type</td>
		<td class='tabh01'>Length</td>
		<td class='tabh01'>Decimals</td>
	</tr>
<?
while($row=$objSDAO->fetch('dom')) {
?>
	<tr>
		<td class='text01'>
			<span class='text01' style="text-decoration:underline;cursor:pointer;" onclick="setDomOnParent('<?=$row['domain']?>')"><?=$row['domain']?></span>
		</td>
		<td class='text01'><?=$row['description']?></td>
		<td class='text01'><?=$row['type']?></td>
		<td class='text01'><?=$row['length']?></td>
		<td class='text01'><?=$row['decimals']?></td>
	</tr>
<?
}
?>
</table>
<?
echo(footerHTML());
exit();